package cn.pn.project.client.base;

import cn.pn.project.pojo.base.Coupon;
import cn.pn.project.pojo.commodity.Commodity;
import cn.pn.project.pojo.user.Usercoupon;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name="pn-base-provider")
@RequestMapping("/coupon")
public interface CouponFeign {

    /**
     * 通过优惠券id查询优惠券信息
     * @param couponId
     * @return
     */
      @RequestMapping("findByCouponId")
    Coupon findByCouponId(@RequestParam("couponId") Integer couponId) throws Exception;

    /**
     * 查询单个商品可以使用的优惠券
     * @param
     * @return
     * @throws Exception
     */
    @RequestMapping("findAllByCouponTypeAndReleId")
    List<Coupon> findAllByCouponTypeAndReleId(@RequestParam("typeId") Integer typeId,@RequestParam("commodityId") Integer commodityId)throws Exception;


    /**
     * 获取所有当前未过期的优惠券
     * @return
     * @throws Exception
     */
    @RequestMapping("findAllCoupon")
    List<Coupon> findAllCoupon()throws  Exception;
}
